//package com.dongdongshop.controller;
//
//import org.apache.rocketmq.client.producer.TransactionSendResult;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.messaging.Message;
//import org.springframework.messaging.support.MessageBuilder;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//@Controller
//@RequestMapping("mq")
//public class MQController {
//
//    @Autowired
//    private RocketMQTemplate rocketMQTemplate;
//
//    @RequestMapping("sendMessageTX")
//    @ResponseBody
//    public String sendMessageTX(String id){
//        //添加数据    Order
//        Message message = MessageBuilder.withPayload("要发送给消费者的消息").build();
//        // 参数1.发送者提供者组 2.消息的topic 3.要发送的消息内容 4.当前项目要使用到的数据(本地事务要使用的参数)
//                                                        // 发送半消息的方法
//        TransactionSendResult result = rocketMQTemplate.sendMessageInTransaction("tx-grou", "-score-topic", message, id);
//        System.out.println(result);
//        return "send ok";
//    }
//}
